package com.jy.modules.cims.component.common.service;
import java.io.Serializable;
import java.util.List;
import java.util.Map;
import java.util.HashMap;

import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.jy.platform.core.common.BaseDTO;

import com.jy.modules.cims.data.common.dto.TCMmCooperorgCostDTO;
import com.jy.modules.cims.data.common.dao.TCMmCooperorgCostDao;

/**
 * @classname: TCMmCooperorgCostService
 * @description: 定义  交易结算表 实现类
 * @author:  JY-IT-D001
 */
@Service("com.jy.modules.platform.tcmmcooperorgcost.service.TCMmCooperorgCostService")
public class TCMmCooperorgCostService implements Serializable {

    private static final long serialVersionUID = 1L;
    
	@Autowired
	private TCMmCooperorgCostDao dao;

	/**
     * @author JY-IT-D001
     * @description: 分页查询 交易结算表列表
     * @date 2016-04-07 15:03:26
     * @param searchParams 条件
     * @return
     * @throws
     */ 
	public List<TCMmCooperorgCostDTO> searchTCMmCooperorgCostByPaging(Map<String,Object> searchParams) throws Exception {
		List<TCMmCooperorgCostDTO> dataList =  dao.searchTCMmCooperorgCostByPaging(searchParams);
		return dataList;
	}
	/**
     * @author JY-IT-D001
     * @description: 按条件查询交易结算表列表
     * @date 2016-04-07 15:03:26
     * @param searchParams 条件
     * @return
     * @throws
     */
	public List<TCMmCooperorgCostDTO> searchTCMmCooperorgCost(Map<String,Object> searchParams) throws Exception {
	    List<TCMmCooperorgCostDTO> dataList = dao.searchTCMmCooperorgCost(searchParams);
        return dataList;
    }
	/**
     * @author JY-IT-D001
     * @description: 查询交易结算表对象
     * @date 2016-04-07 15:03:26
     * @param id
     * @return
     * @throws
     */ 
	public TCMmCooperorgCostDTO queryTCMmCooperorgCostByPrimaryKey(String id) throws Exception {
		
		TCMmCooperorgCostDTO dto = dao.findTCMmCooperorgCostByPrimaryKey(id);
		
		if(dto == null) dto = new TCMmCooperorgCostDTO();
		
		return dto;
		
	}

	/**
     * @title: insertTCMmCooperorgCost
     * @author JY-IT-D001
     * @description: 新增 交易结算表对象
     * @date 2016-04-07 15:03:26
     * @param dto
     * @return
     * @throws
     */
	@SuppressWarnings("all")
	public Long insertTCMmCooperorgCost(TCMmCooperorgCostDTO dto) throws Exception {
		Map<String, Object> paramMap = new HashMap<String, Object>();
		paramMap.put("dto", dto);
		
		int count = dao.insertTCMmCooperorgCost(paramMap);
		
		TCMmCooperorgCostDTO resultDto = (TCMmCooperorgCostDTO) paramMap.get("dto");
		Long keyId = resultDto.getId();
		return keyId;
	}
	/**
     * @title: updateTCMmCooperorgCost   
     * @author JY-IT-D001
     * @description: 修改 交易结算表对象
     * @date 2016-04-07 15:03:26
     * @param paramMap
     * @return
     * @throws
     */
	public void updateTCMmCooperorgCost(TCMmCooperorgCostDTO dto) throws Exception {
		Map<String, Object> paramMap = new HashMap<String, Object>();
		paramMap.put("dto", dto);
		
		dao.updateTCMmCooperorgCost(paramMap);
	}
	
	/**
     * @title: updateTCMmCooperorgCost   updateTCMmCooperorgCostbyCode
     * @author JY-IT-D001
     * @description: 修改 交易结算表对象
     * @date 2016-04-07 15:03:26
     * @param paramMap
     * @return
     * @throws
     */
	public void updateTCMmCooperorgCostbyCode(TCMmCooperorgCostDTO dto) throws Exception {
		Map<String, Object> paramMap = new HashMap<String, Object>();
		paramMap.put("dto", dto);
		
		dao.updateTCMmCooperorgCostbyCode(paramMap);
	}
	/**
     * @title: deleteTCMmCooperorgCostByPrimaryKey
     * @author JY-IT-D001
     * @description: 删除 交易结算表,按主键
     * @date 2016-04-07 15:03:26
     * @param paramMap
     * @throws
     */ 
	public void deleteTCMmCooperorgCostByPrimaryKey(BaseDTO baseDto,String ids) throws Exception {
		if(StringUtils.isEmpty(ids)) throw new Exception("删除失败！传入的参数主键为null");
		
		Map<String, Object> paramMap = new HashMap<String, Object>();
		paramMap.put("dto", baseDto);
		paramMap.put("ids", ids);
		dao.deleteTCMmCooperorgCostByPrimaryKey(paramMap);
	}

}

